<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:rich="http://richfaces.org/rich"       
    xmlns:s="http://jboss.com/products/seam/taglib"
	template="/layout/template.xhtml">

    <ui:define name="head">
      <link href="../stylesheet/useradmin.css" rel="stylesheet" type="text/css"/>
    </ui:define>  
   
    <ui:define name="body">
        
  	    <h1>User Details</h1>
  	    
  	    <h:messages globalOnly="true"/>
  	    
  	    <h:form id="user">
  	    
          <rich:panel styleClass="useradmin">
          <ui:remove>
          <s:decorate id="firstnameField" template="/layout/edit.xhtml">
            <ui:define name="label">First name</ui:define>
            <h:inputText id="firstname" value="#{userAction.firstname}"/>
          </s:decorate>

          <s:decorate id="lastnameField" template="/layout/edit.xhtml">
            <ui:define name="label">Last name</ui:define>
            <h:inputText id="lastname" value="#{userAction.lastname}"/>
          </s:decorate>
          </ui:remove>

          <s:decorate id="usernameField" template="/layout/edit.xhtml">
            <ui:define name="label">Username</ui:define>
            <h:inputText id="username" value="#{userAction.username}" readonly="#{identityManager.userExists(userAction.username)}"/>
          </s:decorate>

          <s:decorate id="passwordField" template="/layout/edit.xhtml">
            <ui:define name="label">Password</ui:define>
            <h:inputSecret id="password" value="#{userAction.password}"/>
          </s:decorate>

          <s:decorate id="confirmField" template="/layout/edit.xhtml">
            <ui:define name="label">Confirm password</ui:define>
            <h:inputSecret id="confirm" value="#{userAction.confirm}"/>
          </s:decorate>

          <s:decorate id="rolesField" template="/layout/edit.xhtml">
            <ui:define name="label">Member of roles</ui:define>
            <div class="selectMany">
              <h:selectManyCheckbox id="roles" value="#{userAction.roles}" layout="pageDirection" styleClass="roles">
                <s:selectItems value="#{identityManager.listGrantableRoles()}" var="_role" label="#{_role}"/>
              </h:selectManyCheckbox>
            </div>
          </s:decorate>

          <s:decorate id="enabledField" template="/layout/edit.xhtml">
            <ui:define name="label">Account enabled</ui:define>
            <h:selectBooleanCheckbox id="enabled" value="#{userAction.enabled}"/>
          </s:decorate>

          <div style="clear: both;"/>
              
          </rich:panel>
          <div class="actionButtons">
            <h:commandButton id="save" value="Save" action="#{userAction.save}"/>
            <s:button id="cancel" view="/useradmin/usermanager.xhtml" value="Cancel" propagation="end"/>
          </div>
    
  	    </h:form>

    </ui:define>
    
</ui:composition>
